package cn.cvs.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import org.apache.ibatis.type.Alias;
import org.springframework.format.annotation.DateTimeFormat;

import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Alias("user")
@XmlRootElement
public class TSysUser implements Serializable {

  private Integer id;
  private String account;
  private String realName;
  private String password;
  private Integer sex;

  //前端到后台
  @DateTimeFormat(pattern= "yyyy-MM-dd")
  //后台到前端
//  @JSONField(format = "yyyy-MM-dd")
  private Date birthday;
  private String phone;
  private String address;
  private Integer roleId;  // int ==null
  private Integer createdUserId;
  private String createdTime;
  private Integer updatedUserId;
  private String updatedTime;
  private String idPicPath;
  private String workPicPath;
  private Integer age;

  //角色名称
  private String xuxiaowa; //记得给get /set

  //ch02示例16 跟角色的映射改成对象映射
  private TSysRole role;//记得给get /set

  //ch02 示例17 嵌套结果映射
  private List<TAddress> addressList;

  public TSysUser() {
  }

  public TSysUser(Integer id) {
    this.id = id;
  }

  public TSysUser(String account) {
      this.account=account;
    }

    public TSysUser(String queryRealName, Integer queryRoleId) {
      this.realName=queryRealName;
      this.roleId =queryRoleId;
    }

    public String getXuxiaowa() {
    return xuxiaowa;
  }

  public void setXuxiaowa(String xuxiaowa) {
    this.xuxiaowa = xuxiaowa;
  }

  public TSysRole getRole() {
    return role;
  }

  public void setRole(TSysRole role) {
    this.role = role;
  }

  public List<TAddress> getAddressList() {
    return addressList;
  }

  public void setAddressList(List<TAddress> addressList) {
    this.addressList = addressList;
  }

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }


  public String getAccount() {
    return account;
  }

  public void setAccount(String account) {
    this.account = account;
  }


  public String getRealName() {
    return realName;
  }

  public void setRealName(String realName) {
    this.realName = realName;
  }


  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }


  public Integer getSex() {
    return sex;
  }

  public void setSex(Integer sex) {
    this.sex = sex;
  }


  public Date getBirthday() {
    return birthday;
  }

  public void setBirthday(Date birthday) {
    this.birthday = birthday;
  }


  public String getPhone() {
    return phone;
  }

  public void setPhone(String phone) {
    this.phone = phone;
  }


  public String getAddress() {
    return address;
  }

  public void setAddress(String address) {
    this.address = address;
  }


  public Integer getRoleId() {
    return roleId;
  }

  public void setRoleId(Integer roleId) {
    this.roleId = roleId;
  }


  public Integer getCreatedUserId() {
    return createdUserId;
  }

  public void setCreatedUserId(Integer createdUserId) {
    this.createdUserId = createdUserId;
  }


  public String getCreatedTime() {
    return createdTime;
  }

  public void setCreatedTime(String createdTime) {
    this.createdTime = createdTime;
  }


  public Integer getUpdatedUserId() {
    return updatedUserId;
  }

  public void setUpdatedUserId(Integer updatedUserId) {
    this.updatedUserId = updatedUserId;
  }


  public String getUpdatedTime() {
    return updatedTime;
  }

  public void setUpdatedTime(String updatedTime) {
    this.updatedTime = updatedTime;
  }


  public String getIdPicPath() {
    return idPicPath;
  }

  public void setIdPicPath(String idPicPath) {
    this.idPicPath = idPicPath;
  }


  public String getWorkPicPath() {
    return workPicPath;
  }

  public void setWorkPicPath(String workPicPath) {
    this.workPicPath = workPicPath;
  }

  public Integer getAge() {
    return age;
  }

  public void setAge(Integer age) {
    this.age = age;
  }

  @Override
  public String toString() {
    return "TSysUser{" +
            "id=" + id +
            ", account='" + account + '\'' +
            ", realName='" + realName + '\'' +
            ", password='" + password + '\'' +
            ", sex=" + sex +
            ", birthday='" + birthday + '\'' +
            ", phone='" + phone + '\'' +
            ", address='" + address + '\'' +
            ", roleId=" + roleId +
            ", roleName=" + xuxiaowa +
            ", createdUserId=" + createdUserId +
            ", createdTime='" + createdTime + '\'' +
            ", updatedUserId=" + updatedUserId +
            ", updatedTime='" + updatedTime + '\'' +
            ", idPicPath='" + idPicPath + '\'' +
            ", workPicPath='" + workPicPath + '\'' +
          /*  ", roleId='" + role.getId() + '\'' +
            ", roleCode='" + role.getCode() + '\'' +
            ", roleName='" + role.getRoleName() + '\'' +*/
            '}';
  }
}
